package com.zhiwei.common.config;

import com.zhiwei.common.service.CacheService;
import com.zhiwei.common.service.impl.DefaultCacheServiceImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * function 缓存配置
 * author zhiwei.yang
 * time 2020-2-29-9:40
 */
@Configuration
public class CacheConfig {

    /**
     * 缺省缓存服务：生产推荐Redis
     * @return
     */
    @Bean
    @ConditionalOnMissingBean(CacheService.class)
    public CacheService cacheService(){
        return new DefaultCacheServiceImpl();
    }
}
